<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Freetype OpenGL: Texture font</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="content"><!-- do not remove this div! -->

<div id="top"><!-- do not remove this div! -->

  
  <div id="titlearea">
    
    <div id="projectname">Freetype OpenGL</div>
    
    
    <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
    
  </div>
  

<!--

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Freetype OpenGL
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>
-->


<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript" src="dynsections.js"></script>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Texture font</div>  </div>
</div><!--header-->
<div class="contents">
<hr/><a name="details" id="details"></a><h2>Synopsis</h2>
<p>Texture font. </p>
<p>Example Usage: </p>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include &quot;<a class="code" href="texture-font_8h.html">texture-font.h</a>&quot;</span>

 <span class="keywordtype">int</span> main( <span class="keywordtype">int</span> arrgc, <span class="keywordtype">char</span> *argv[] )
 {
   <span class="keywordflow">return</span> 0;
 }
</pre></div> <table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structkerning__t.html">kerning_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A structure that hold a kerning value relatively to a charcode.  <a href="structkerning__t.html#details">More...</a><br/></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtexture__glyph__t.html">texture_glyph_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A structure that describe a glyph.  <a href="structtexture__glyph__t.html#details">More...</a><br/></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtexture__font__t.html">texture_font_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Texture font structure.  <a href="structtexture__font__t.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga904424e7b0e2be14b694599b5c483e64"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structtexture__font__t.html">texture_font_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__texture-font.html#ga904424e7b0e2be14b694599b5c483e64">texture_font_new</a> (<a class="el" href="structtexture__atlas__t.html">texture_atlas_t</a> *atlas, const char *filename, const float size)</td></tr>
<tr class="memdesc:ga904424e7b0e2be14b694599b5c483e64"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function creates a new texture font from given filename and size.  <a href="#ga904424e7b0e2be14b694599b5c483e64"></a><br/></td></tr>
<tr class="memitem:gaa894ab1def90197eaad58b578e7a2440"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__texture-font.html#gaa894ab1def90197eaad58b578e7a2440">texture_font_delete</a> (<a class="el" href="structtexture__font__t.html">texture_font_t</a> *self)</td></tr>
<tr class="memdesc:gaa894ab1def90197eaad58b578e7a2440"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete a texture font.  <a href="#gaa894ab1def90197eaad58b578e7a2440"></a><br/></td></tr>
<tr class="memitem:ga06e988448ef6e118aa6e273df5892937"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structtexture__glyph__t.html">texture_glyph_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__texture-font.html#ga06e988448ef6e118aa6e273df5892937">texture_font_get_glyph</a> (<a class="el" href="structtexture__font__t.html">texture_font_t</a> *self, wchar_t charcode)</td></tr>
<tr class="memdesc:ga06e988448ef6e118aa6e273df5892937"><td class="mdescLeft">&#160;</td><td class="mdescRight">Request a new glyph from the font.  <a href="#ga06e988448ef6e118aa6e273df5892937"></a><br/></td></tr>
<tr class="memitem:ga912b65dd3d45ced38640cdfbecbb51c5"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__texture-font.html#ga912b65dd3d45ced38640cdfbecbb51c5">texture_font_load_glyphs</a> (<a class="el" href="structtexture__font__t.html">texture_font_t</a> *self, const wchar_t *charcodes)</td></tr>
<tr class="memdesc:ga912b65dd3d45ced38640cdfbecbb51c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Request the loading of several glyphs at once.  <a href="#ga912b65dd3d45ced38640cdfbecbb51c5"></a><br/></td></tr>
<tr class="memitem:ga77d1adb569e7eaa4aaf776dc28415c66"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__texture-font.html#ga77d1adb569e7eaa4aaf776dc28415c66">texture_glyph_get_kerning</a> (const <a class="el" href="structtexture__glyph__t.html">texture_glyph_t</a> *self, const wchar_t charcode)</td></tr>
<tr class="memdesc:ga77d1adb569e7eaa4aaf776dc28415c66"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the kerning between two horizontal glyphs.  <a href="#ga77d1adb569e7eaa4aaf776dc28415c66"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gaa894ab1def90197eaad58b578e7a2440"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="group__texture-font.html#gaa894ab1def90197eaad58b578e7a2440">texture_font_delete</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structtexture__font__t.html">texture_font_t</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Delete a texture font. </p>
<p>Note that this does not delete the glyph from the texture atlas.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a valid texture font </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo-atb-agg_8c-example.html#a37">demo-atb-agg.c</a>, <a class="el" href="demo-distance-field_8c-example.html#a6">demo-distance-field.c</a>, <a class="el" href="demo-font_8c-example.html#a30">demo-font.c</a>, and <a class="el" href="demo-texture_8c-example.html#a5">demo-texture.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga06e988448ef6e118aa6e273df5892937"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structtexture__glyph__t.html">texture_glyph_t</a>* <a class="el" href="group__texture-font.html#ga06e988448ef6e118aa6e273df5892937">texture_font_get_glyph</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structtexture__font__t.html">texture_font_t</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">wchar_t&#160;</td>
          <td class="paramname"><em>charcode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Request a new glyph from the font. </p>
<p>If it has not been created yet, it will be.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>A valid texture font </td></tr>
    <tr><td class="paramname">charcode</td><td>Character codepoint to be loaded.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>A pointer on the new glyph or 0 if the texture atlas is not big enough </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo-atb-agg_8c-example.html#a35">demo-atb-agg.c</a>, <a class="el" href="demo-benchmark_8c-example.html#a10">demo-benchmark.c</a>, <a class="el" href="demo-cartoon_8c-example.html#a7">demo-cartoon.c</a>, <a class="el" href="demo-console_8c-example.html#a19">demo-console.c</a>, <a class="el" href="demo-display-list_8c-example.html#a7">demo-display-list.c</a>, <a class="el" href="demo-font_8c-example.html#a10">demo-font.c</a>, and <a class="el" href="demo-outline_8c-example.html#a13">demo-outline.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga912b65dd3d45ced38640cdfbecbb51c5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t <a class="el" href="group__texture-font.html#ga912b65dd3d45ced38640cdfbecbb51c5">texture_font_load_glyphs</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structtexture__font__t.html">texture_font_t</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const wchar_t *&#160;</td>
          <td class="paramname"><em>charcodes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Request the loading of several glyphs at once. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a valid texture font </td></tr>
    <tr><td class="paramname">charcodes</td><td>character codepoints to be loaded.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>Number of missed glyph if the texture is not big enough to hold every glyphs. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo-atb-agg_8c-example.html#a33">demo-atb-agg.c</a>, <a class="el" href="demo-display-list_8c-example.html#a25">demo-display-list.c</a>, <a class="el" href="demo-distance-field_8c-example.html#a5">demo-distance-field.c</a>, <a class="el" href="demo-font_8c-example.html#a29">demo-font.c</a>, and <a class="el" href="demo-texture_8c-example.html#a4">demo-texture.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga904424e7b0e2be14b694599b5c483e64"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structtexture__font__t.html">texture_font_t</a>* <a class="el" href="group__texture-font.html#ga904424e7b0e2be14b694599b5c483e64">texture_font_new</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structtexture__atlas__t.html">texture_atlas_t</a> *&#160;</td>
          <td class="paramname"><em>atlas</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>This function creates a new texture font from given filename and size. </p>
<p>The texture atlas is used to store glyph on demand. Note the depth of the atlas will determine if the font is rendered as alpha channel only (depth = 1) or RGB (depth = 3) that correspond to subpixel rendering (if available on your freetype implementation).</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">atlas</td><td>A texture atlas </td></tr>
    <tr><td class="paramname">filename</td><td>A font filename </td></tr>
    <tr><td class="paramname">size</td><td>Size of font to be created (in points)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>A new empty font (no glyph inside yet) </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo-atb-agg_8c-example.html#a29">demo-atb-agg.c</a>, <a class="el" href="demo-benchmark_8c-example.html#a32">demo-benchmark.c</a>, <a class="el" href="demo-cartoon_8c-example.html#a24">demo-cartoon.c</a>, <a class="el" href="demo-console_8c-example.html#a11">demo-console.c</a>, <a class="el" href="demo-display-list_8c-example.html#a24">demo-display-list.c</a>, <a class="el" href="demo-distance-field_8c-example.html#a4">demo-distance-field.c</a>, <a class="el" href="demo-font_8c-example.html#a27">demo-font.c</a>, <a class="el" href="demo-outline_8c-example.html#a32">demo-outline.c</a>, and <a class="el" href="demo-texture_8c-example.html#a3">demo-texture.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga77d1adb569e7eaa4aaf776dc28415c66"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float <a class="el" href="group__texture-font.html#ga77d1adb569e7eaa4aaf776dc28415c66">texture_glyph_get_kerning</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structtexture__glyph__t.html">texture_glyph_t</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const wchar_t&#160;</td>
          <td class="paramname"><em>charcode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the kerning between two horizontal glyphs. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a valid texture glyph </td></tr>
    <tr><td class="paramname">charcode</td><td>codepoint of the peceding glyph</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>x kerning value </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="demo-atb-agg_8c-example.html#a36">demo-atb-agg.c</a>, <a class="el" href="demo-benchmark_8c-example.html#a11">demo-benchmark.c</a>, <a class="el" href="demo-cartoon_8c-example.html#a8">demo-cartoon.c</a>, <a class="el" href="demo-console_8c-example.html#a20">demo-console.c</a>, <a class="el" href="demo-display-list_8c-example.html#a8">demo-display-list.c</a>, <a class="el" href="demo-font_8c-example.html#a11">demo-font.c</a>, and <a class="el" href="demo-outline_8c-example.html#a14">demo-outline.c</a>.</dd>
</dl>
</div>
</div>
</div><!-- contents -->
</div>
</body>
</html>
